package com.qf.deployee.service.impl;

import com.qf.deployee.mapper.UserMapper;
import com.qf.deployee.pojo.User;
import com.qf.deployee.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.List;

/**
 * @Auther: xiaobobo
 * @Date: 2019/5/29 11:07
 * @Description:
 */
@Service
public class UserService implements IUserService {

    @Autowired
    private UserMapper userMapper=null;


    // @Scheduled ：实现定时任务的注解

    @PostConstruct
    public void init(){
        System.out.println("这个注解的作用是用来实现在对象加入IOC的时候实现数据初始化");
    }


    @Override
    public List<User> list() {
        return userMapper.list();
    }


    @PreDestroy
    public void destory(){
       System.out.println("对象在IOC容器中销毁的时候 执行的函数...");
    }
}
